#ifndef __DBACCOUNT_LOGIN_FAILEDSENDER_H__
#define __DBACCOUNT_LOGIN_FAILEDSENDER_H__

#include "gwmessagemap.hpp"
#include "IMessageOperator.h"
#include "protonet.hpp"
#include "netlib.h"
#include "../DBServer.h"
#include "dbserver.pb.h"
#include "../../Sender/DBServerSender.h"

/**
*@file       DBAccount_Login_FailedSender.h
*@brief      send message DBAccount_Login_Failed
*
*@author     graywind
*@version    1.0.0.0
*@data       2012/3/28
*/

///message wrapper
class msgDBAccount_Login_Failed
{
public:
    static const int MessageId = DBAccount_Login_Failed;
    //TODO
    pnSessionHandle SessionId;
    LoginFailed     MsgContent;
    ///@brief      constructor
    ///param[in]   session_id     identifier of the session
    ///param[in]   error          error code
    ///param[in]   login_code     code of the login server
    msgDBAccount_Login_Failed(int session_id, LoginFailed::eErrorCode error, int login_code):
    SessionId(session_id)
    {
        MsgContent.set_errorcode(error);
        MsgContent.set_logincode(login_code);
    }
};

class HandleDBAccount_Login_Failed
{
public:
    ///@brief     handle message
    ///param[in]  msg     message wrapper of DBAccount_Login_Failed
    ///retval     void
    static void HandleMessage(msgDBAccount_Login_Failed* msg)
    {
        //TODO
        //Main Message:  msgDBServer
        msgDBServer mainMsg(msg->SessionId, msgDBAccount_Login_Failed::MessageId, ProtoNet<LoginFailed>::IntoBytes(msg->MsgContent));
        gwMessagePort::ProcessMessage(&mainMsg);
    }
};
///[message wrapper]  [handler]
RegisterHandler(msgDBAccount_Login_Failed, HandleDBAccount_Login_Failed);

#endif
